package org.zhuyx.ch01.shili.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.zhuyx.ch01.shili.dao.PetDao;
import org.zhuyx.ch01.shili.dao.impl.PetDaoMysqlImpl;
import org.zhuyx.ch01.shili.entity.Pet;
import org.zhuyx.ch01.shili.service.PetService;

/**
 * @author 茜茜
 * @date 2024-12-05 11:23
 */
@Service("petService")
public class PetServiceImpl implements PetService {
    //简单工厂获取
//    PetDao petDao=new PetDaoMysqlImpl();
@Autowired(required = false)
    private PetDao petDao=null;

    public PetDao getPetDao() {
        return petDao;
    }

    public void setPetDao(PetDao petDao) {
        this.petDao = petDao;
    }

    @Override
    public boolean insert(Pet pet) {
        return petDao.insert(pet)>0;
    }
}
